<?php
namespace  Admin\Model;
use  Think\Model;
class OrdersModel extends Model {
 
	protected  $autoCheckFields=false;
	//==============================用户操作
	public function listPorders($firstRow = 0, $listRows = 10) {
		$M = M("orders");
		$list = $M->order("`id` DESC")->limit("$firstRow , $listRows")->select();
		return $list;
	}
   
    public  function addMap($data){
    	$M=M('map');
    	if(empty($data['min'])){
    		$this->error='请输入订单时间';
    		return false;
    	}
    	if(empty($data['buyer'])){
    		$this->error='请输入购买人';
    		return false;
    	}
    	if(empty($data['city'])){
    		$this->error='请输入城市';
    		return false;
    	}
    	if(empty($data['products'])){
    		$this->error='请输入产品';
    		return false;
    	}
    	if(empty($data['price'])){
    		$this->error='请输入价格';
    		return false;
    	}
       if($M->add($data)){
       	  return true;
       }else{
       	   $this->error="添加失败";
       	   return false;
       }
    }
	
    
    public  function editMap($data){
    	$M=M('map');
    	if(empty($data['id'])){
    		$this->error='ID不存在';
    		return false;
    	}
    	if($M->save($data)){
    		return true;
    	}else{
    		$this->error="修改失败";
    		return false;
    	}
    }
	
}

?>
